{extend name="common/base"}
{block name="content"}
<style>
    [class*=am-u-]+[class*=am-u-]:last-child{
        float: left!important;
    }
    label{
        text-align: left!important;
    }
    input[type=checkbox]{
        float: right;
    }
    .checkbox{
        padding-top:5px!important;
    }
</style>
<!-- 内容区域 -->
<div class="tpl-content-wrapper">
        <div class="row">

            <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                <div class="widget am-cf">
                    <div class="widget-head am-cf">
                        <div class="widget-title am-fl">编辑角色权限</div>
                        <div class="widget-function am-fr">
                            <a href="javascript:;" class="am-icon-cog"></a>
                        </div>
                    </div>
                    <div class="widget-body am-fr">
                        <form class="am-form tpl-form-border-form tpl-form-border-br" action="{:url('admin/auth/permissionSave')}" method="POST" enctype="multipart/form-data">
                            {volist name="permission_list" id="val"}
                            <div class="am-form-group">
                                <div class="am-u-sm-3 checkbox">
                                   <input type="checkbox" id="permiss-{$val.permission_id}" name="permission_id[]" value="{$val.permission_id}" {if condition="in_array($val.permission_id,$hasPermission_ids)"}checked {/if}>
                                </div>
                                <label for="permiss-{$val.permission_id}" class="am-u-sm-9 am-form-label">{$val.name}</label>
                                {if condition="isset($val['son'])"}
                                <div class="am-u-sm-9 am-u-sm-push-3">
                                {volist name="val['son']" id="v"}
                                <div class="am-form-group am-u-sm-3">
                                    <div class="am-u-sm-3 checkbox">
                                    <input type="checkbox" id="permiss-{$v.permission_id}" name="permission_id[]" value="{$v.permission_id}" {if condition="in_array($v.permission_id,$hasPermission_ids)"}checked {/if}> 
                                    </div>
                                    <label class="am-form-label am-u-sm-9" for="permiss-{$v.permission_id}" class="am-u-sm-9 am-form-label">{$v.name}</label>
                                </div>
                                {/volist}
                                 </div>
                                {/if}
                            </div>
                            {/volist}
                            <input type="hidden" value="{$role_id}" name="role_id">
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3">
                                    <button type="submit" class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
{/block}